package com.test.payproject.controller;

import com.alipay.api.AlipayApiException;
import com.test.payproject.bean.AlipayBean;
import com.test.payproject.service.PayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController()
@RequestMapping("order")
public class OrderController {
    @Resource
    private PayService payService;

    @PostMapping(value =  "alipay")
    public String alipay(String out_trade_no,String subject,String total_amount,String body) throws AlipayApiException {
        AlipayBean alipayBean = new AlipayBean();
        alipayBean.setBody(body);
        alipayBean.setOut_trade_no(out_trade_no);
        alipayBean.setTotal_amount(total_amount);
        alipayBean.setSubject(subject);
        return  payService.aliPay(alipayBean);
    }
}
